<template>
    <div>
        <ul class="mui-table-view">
            <li class="mui-table-view-cell mui-media" v-for="item in newslist" :key="item.id">
                <router-link :to="'/home/newsInfo/'+item.id">
                    <img class="mui-media-object mui-pull-left" :src="item.img_url">
                    <div class="mui-media-body">
                        <h1>{{item.title}}</h1>
                        <p class='mui-ellipsis'>
                            <span>发表时间:{{item.add_time | dataFormat}}</span>
                            <span>点击:{{item.click}}次</span>
                        </p>
                    </div>
                </router-link>
            </li>
        </ul>
    </div>
</template>

<script>
    import { Toast } from 'mint-ui'

    import newslist1 from '../../images/503d269759ee3d6d862ae9fd45166d224f4ade1c.jpg'
    import newslist2 from '../../images/96096-523440.jpg'
    import newslist3 from '../../images/sunxiaochuan.jpg'

    export default {
        data(){
            return{
                newslist: [
                    {add_time:'2019-01-21T16:56:28.000Z', click:1, id:13, img_url:newslist1,title:'日本抽象留学生孙笑川第一个走出考场', zhaiyao:'孙笑川的成名之路'},
                    {add_time:'2019-01-21T16:59:28.000Z', click:2, id:14, img_url:newslist2,title:'要恰饭的嘛', zhaiyao:'证据确凿 百口莫辩'},
                    {add_time:'2019-01-21T16:56:28.000Z', click:3, id:15, img_url:newslist3,title:'日本抽象留学生孙笑川第一个走出考场', zhaiyao:'没有意义 没有意义!!'},
                    {add_time:'2019-01-21T16:59:28.000Z', click:4, id:16, img_url:newslist2,title:'要恰饭的嘛', zhaiyao:'证据确凿 百口莫辩'},
                    {add_time:'2019-01-21T16:56:28.000Z', click:5, id:17, img_url:newslist1,title:'日本抽象留学生孙笑川第一个走出考场 我是真的佛了', zhaiyao:'没有意义 没有意义!!'},
                    {add_time:'2019-01-21T16:59:28.000Z', click:6, id:18, img_url:newslist2,title:'要恰饭的嘛', zhaiyao:'证据确凿 百口莫辩'},
                    {add_time:'2019-01-21T16:56:28.000Z', click:3, id:19, img_url:newslist1,title:'日本抽象留学生孙笑川第一个走出考场', zhaiyao:'没有意义 没有意义!!'},
                    {add_time:'2019-01-21T16:59:28.000Z', click:4, id:20, img_url:newslist2,title:'要恰饭的嘛', zhaiyao:'证据确凿 百口莫辩'},
                    {add_time:'2019-01-21T16:56:28.000Z', click:5, id:21, img_url:newslist1,title:'日本抽象留学生孙笑川第一个走出考场', zhaiyao:'没有意义 没有意义!!'},
                    {add_time:'2019-01-21T16:59:28.000Z', click:6, id:22, img_url:newslist2,title:'要恰饭的嘛', zhaiyao:'证据确凿 百口莫辩'},
                    {add_time:'2019-01-21T16:56:28.000Z', click:3, id:23, img_url:newslist1,title:'日本抽象留学生孙笑川第一个走出考场', zhaiyao:'没有意义 没有意义!!'},
                    {add_time:'2019-01-21T16:59:28.000Z', click:4, id:24, img_url:newslist2,title:'要恰饭的嘛', zhaiyao:'证据确凿 百口莫辩'},
                    {add_time:'2019-01-21T16:56:28.000Z', click:5, id:25, img_url:newslist1,title:'日本抽象留学生孙笑川第一个走出考场', zhaiyao:'没有意义 没有意义!!'},
                    {add_time:'2019-01-21T16:59:28.000Z', click:6, id:26, img_url:newslist2,title:'要恰饭的嘛', zhaiyao:'证据确凿 百口莫辩'},
                ]
            }
        },
        created(){ this.getNewsList() },
        methods:{
        getNewsList(){
            this.$http.get('').then(result => {
                if(result.body.status === 0 ){
                    this.newslist = result.body.message;     //获取成功
                    Toast('加载成功');
                }else{
                    Toast('加载失败');
                    //获取失败
                }
            })
        }
        },
    }
</script>

<style lang="scss" scoped>
    .mui-table-view{
        img{
            height: 42px;
            width: 42px;
        }
        li{
            h1{
                font-size:14px;
            }
        }
    }
    .mui-ellipsis{
        font-size:12px;
        font-color:lightskyblue;
        display:flex;
        justify-content: space-between;
    }
</style>
